#Visions are user uploaded images - albums
class Vision < Asset

   #file_column :image,
   #      :web_root => "files/", 
   #      :root_path => File.join(RAILS_ROOT, "public", "files"),
   #      :magick => { 
   #      :geometry => "357",
   #      :versions => { "icon" => "22x22", 
   #                     "small" => "57x57", 
   #                     "display" => "357x357",
   #                     "big" => "700x500" 
   #                   }
   #      }

  belongs_to :friend
  #belongs_to :fot

  has_attachment  :content_type => :image,
                  :storage      => :file_system,
                  :processor => :rmagick,
                  :path_prefix  => "public/assets/visions/",
                  :size         => 1..1.megabytes,
                  :thumbnails   => { :icon => "22x22!",
                                     :small => "57x57!",
                                     :display => "357x",
                                     :big => "714x" }



  validates_presence_of   :content_type, :filename

  def content_html
   content.nil? ? "" : RedCloth.new(content).to_html(:textile)
  end

  def self.list(page, cond)
    paginate :per_page => 9, 
             :page => page,
             :conditions => cond,
             :order => 'created_at desc'
  end

end
